package com.bandapp.ui;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class BandActivity extends TabActivity {

	/*
	 * (non-Javadoc)
	 * @see android.app.ActivityGroup#onCreate(android.os.Bundle)
	 * basic example by
	 *  http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
	 */
	 	@Override
	    public void onCreate(Bundle icicle)
	    {
	        super.onCreate(icicle);
	        setContentView(R.layout.tab_activity);
	        
	        TabHost tabHost = getTabHost(); // The activity Tabhost
	        TabHost.TabSpec spec; // Reusable TabSpec for each tab
	        Intent intent; // Reusable Intent for each tab
	        Resources res = getResources();
	        Intent thisIntent = getIntent();
	        Bundle extras = thisIntent.getExtras();
	        // Create an Intent to launch an Activity for the tab (to be reused)
	        intent = new Intent().setClass(this, RSSFeedActivity.class);
	        intent.putExtra("position",extras.getInt("position"));
	        // Initialize a TabSpec for each tab and add it to the TabHost
	        spec = tabHost.newTabSpec("RSSFeed").setIndicator("RSSFeed",
	                          res.getDrawable(R.drawable.ic_tab_artists))
	                      .setContent(intent);
	        tabHost.addTab(spec);
	        
	        // Do the same for the other tabs
	        intent = new Intent().setClass(this, TourDatesActivity.class);
	        intent.putExtra("position",extras.getInt("position"));
	        spec = tabHost.newTabSpec("Tourdates").setIndicator("Tourdates",
	                          res.getDrawable(R.drawable.icon))
	                      .setContent(intent);
	        tabHost.addTab(spec);

	        intent = new Intent().setClass(this,YoutubeActivity.class);
	        intent.putExtra("position",extras.getInt("position"));
	        spec = tabHost.newTabSpec("Youtube").setIndicator("Youtube",
	                          res.getDrawable(R.drawable.icon))
	                      .setContent(intent);
	        tabHost.addTab(spec);

	        tabHost.setCurrentTab(0);

	        
	        
	    }
	       
}

